package com.wwl.springcloud.controller;

import com.wwl.springcloud.dto.CommonResult;
import com.wwl.springcloud.dto.Payment;
import com.wwl.springcloud.services.PaymentFeignServices;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/8/10 16:00
 * @description:
 */
@RestController
@Api(value = "/consumer",description = "支付", tags = {"consumer"})
public class OrderFeignController {
    @Resource
    private PaymentFeignServices paymentFeignServices;
    @ApiOperation("openFeign测试使用")
    @PostMapping (value = "/consumer/payment/get")
    public CommonResult<Payment> getPaymentById(@ApiParam(value = "id") @RequestParam(value = "id",required = false) Integer id){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        return paymentFeignServices.getPaymentById(map);
    }
    @ApiOperation("openFeign超时测试使用")
    @GetMapping(value = "/consumer/payment/feign/timeout")
    public String paymentFeignTimeout(){
        return paymentFeignServices.paymentFeignTimeout();
    }

}
